<?php

/**
 * Project: Espolon
 * Licence: BSD License
 * Link: http://espolon.org/
 * Copyright: Nicolas de Bari Embriz Garcia Rojas <nbari at espolon dot org>
 * Author: Nicolas de Bari Embriz Garcia Rojas <nbari at espolon dot org>
 * Version: Beta
 */

require_once 'giztimer.inc.php';
$timer = new Giz_Timer();

/**
 * Required files
 */
require_once 'config.php';
require_once 'error_handler.php';
require_once 'class.mymailer.php';
require_once 'HTML/QuickForm.php';
require_once 'HTML/QuickForm/Renderer/ArraySmarty.php';
require_once SMARTY_DIR.'Smarty.class.php';
require_once 'smarty.inc.php';
require_once 'functions.inc.php';
require_once 'dispatcher.inc.php';

/**
 * ADODB
 */
define('ADODB_OUTP', 'debug_sql');
$debug = '';
$ADODB_CACHE_DIR = ADODB_CACHE_DIR;
require_once ADODB_DIR.'adodb-errorhandler.inc.php';
require_once ADODB_DIR.'adodb.inc.php';
require_once ADODB_DIR.'session/adodb-session2.php';
$options['table'] = 'core_sessions2';
ADOdb_Session::config(DB_TYPE, DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE, $options);
ADODB_Session::optimize(true);

/**
 * Start session
 */
sess_start();

$GLOBALS['UID'] =  (isset($_SESSION['uid'])) ? $_SESSION['uid'] : null;
$ADODB_SESSION_EXPIRE_NOTIFY = array('UID','NotifyFn');

if (sess_get('uid')) { if((rand()%10) == 0) setcookie("sess", session_id(), time()+3600, '/'); }

?>